#include <iostream>
// #include <list>

using namespace std;
template<typename objectType>

class list
{
private:
    objectType* pointer;
    size_t counter = 0;
public:
    list()
    {
       pointer = new objectType[10](); //申请10个objectType类型的动态内存, 存入pointer 动态内存数组初始化为0
    }
    ~list()
    {
        delete[] pointer;
    }
    void push_back(const objectType& inputElement)
    {
        pointer[counter] = inputElement;
        counter++;
    }

    size_t size(void)
    {
        return counter;
    }

    objectType operator [](size_t position) //指针数组形式访问 访问其值
    {
        return pointer[position];
    }
};

int main(int argc, char const *argv[])
{
    list<int>listArray;
    listArray.push_back(5);
    listArray.push_back(111);
    for(size_t i = 0; i < listArray.size(); i++)
    {
        cout << listArray[i] << endl;
    }
    cout << listArray[3] << endl;
    return 0;
}
